home *** CD-ROM | disk | FTP | other *** search
-
-
-
- iiiillllCCCCaaaallllllllbbbbaaaacccckkkk((((3333)))) IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll iiiillllCCCCaaaallllllllbbbbaaaacccckkkk((((3333))))
-
-
-
- NNNNAAAAMMMMEEEE
- iiiillllCCCCaaaallllllllbbbbaaaacccckkkk - generic call back mechanism
-
- IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
- ilCacheBase
-
- HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
- #include <il/ilCallback.h>
-
- CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- This class provide a generic call back mechanism. There are two derived
- class templates, ilFunctionCallback and ilMethodCallback, that provide
- either normal function callbacks or callbacks to a method on some object,
- repectively.
-
- The ilFunctionCallback template is used to create a callback to a
- function that takes an argument, _u_s_e_r_A_r_g, that is supplied when the
- callback is created and a second argument, _c_a_l_l_e_r_A_r_g that is passed from
- the callsite of the callback (i.e. when ddddooooiiiitttt() is called). A callback
- function, 'func', thus has the prototype:
-
- ilStatus func(UserArgType userArg, CallerArgType callerArg);
-
-
- The ilMethodCallback template is used to create a callback to a method on
- an object of type UserClass that takes an argument, _u_s_e_r_A_r_g, that is
- supplied when the callback is created and a second argument, _c_a_l_l_e_r_A_r_g,
- that is passed from the callsite of the callback (i.e. when ddddooooiiiitttt() is
- called). Thus a callback 'method' would have the prototype:
-
- ilStatus UserClass::method(UserArgType userArg, CallerArgType callerArg);
-
-
- CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
- CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
-
- ilFunctionCallback(ilStatus (*func)(UserArgType userArg,
- CallerArgType callerArg),
- UserArgType userArg)
- ilMethodCallback(UserClass* object,
- ilStatus (UserClass::*method)(UserArgType userArg,
- CallerArgType callerArg),
- UserArgType userArg)
- ilNullCallback()
-
- CCCCaaaallllllllbbbbaaaacccckkkk aaaaccccttttiiiioooonnnn
-
- virtual ilStatus doit(void* callerArg)
-
- SSSSeeeetttt mmmmeeeetttthhhhooooddddssss
-
-
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- iiiillllCCCCaaaallllllllbbbbaaaacccckkkk((((3333)))) IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll iiiillllCCCCaaaallllllllbbbbaaaacccckkkk((((3333))))
-
-
-
- void setUserArg(UserArgType userArg)
-
-
- FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
- iiiillllFFFFuuuunnnnccccttttiiiioooonnnnCCCCaaaallllllllbbbbaaaacccckkkk(((())))
-
- ilFunctionCallback(ilStatus (*func)(UserArgType userArg,
- CallerArgType callerArg),
- UserArgType userArg)
-
-
- This constructor creates a callback to function, _f_u_n_c, with user
- argument, _u_s_e_r_A_r_g.
-
- To define a callback to a simple function rrrreeeeaaaaddddyyyy() you might do
- something like:
-
- ...
- ilStatus ready(UserType*, CallerType*) { ... }
- ...
- typedef ilFunctionCallback<UserType*,CallerType*> UserCallback;
-
- Bar bar;
- UserType userArg;
- UserCallback doneCb(ready, &userArg);
-
-
- and to invoke it from the callsite you would write something like:
-
- CallerType callerArg;
- donecb.doit(&callerArg);
-
-
- iiiillllMMMMeeeetttthhhhooooddddCCCCaaaallllllllbbbbaaaacccckkkk(((())))
-
- ilMethodCallback(UserClass* object,
- ilStatus (UserClass::*method)(UserArgType userArg,
- CallerArgType callerArg),
- UserArgType userArg)
-
-
- This constructor creates a callback to _U_s_e_r_C_l_a_s_s::_m_e_t_h_o_d, with user
- argument, _u_s_e_r_A_r_g.
-
- To define a callback to a member function BBBBaaaarrrr::::::::ddddoooonnnneeee() you might do
- something like:
-
- ...
- ilStatus Bar::done(UserType*, CallerType*) { ... }
- ...
- typedef ilMethodCallback<Bar,UserType*,CallerType*> UserCallback;
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-
-
-
- iiiillllCCCCaaaallllllllbbbbaaaacccckkkk((((3333)))) IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll iiiillllCCCCaaaallllllllbbbbaaaacccckkkk((((3333))))
-
-
-
- Bar bar;
- UserType userArg;
- UserCallback doneCb(&bar, Bar::done, &userArg);
-
-
- and to invoke it from the callsite you would write something like:
-
- CallerType callerArg;
- donecb.doit(&callerArg);
-
-
- iiiillllNNNNuuuullllllllCCCCaaaallllllllbbbbaaaacccckkkk(((())))
-
- ilNullCallback()
-
-
- This constructor creates a callback that does nothing.
-
- ddddooooiiiitttt(((())))
-
- virtual ilStatus doit(void* callerArg)
-
-
- This method is called to trigger the callback; the semantics of this
- are defined by one of two derived classes: either ilFunctionCallback
- or ilMethodCallback. The returned value is the value returned from
- the callback function or method.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- ilCallbackList(3)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 3333
-
-
-
-